package com.book.service.impl;

import com.book.dao.ShopCarDao;
import com.book.dto.ShopCarDto;
import com.book.helper.ShopCarHelper;
import com.book.pojo.ShopCar;
import com.book.service.ShopCarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author 李锦程
 * @Date 2020/12/27 2:00 下午
 * @Package com.book.service.impl
 * @Version 1.0
 */
@Service
public class ShopCarServiceImpl implements ShopCarService {
    @Autowired
    private ShopCarDao shopCarDao;

    @Override
    public void insertShopCar(ShopCarDto car) {
        ShopCar shopCar = ShopCarHelper.covertDtoPo(car);
        shopCarDao.insertSelective(shopCar);
    }

    @Override
    public ShopCarDto getCarByUId(Integer uId) {
        ShopCar carByUId = shopCarDao.getCarByUId(uId);
        return ShopCarHelper.convertPoDto(carByUId);
    }
}
